﻿<!DOCTYPE html>
<!--承包商人员名录管理弹出用-->
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

</head>
<body>
    <div id="app" v-cloak class="popupW50">
        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
                 style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">            
                            <el-button type="primary" @click="onSubmit">{{col.btnSelect}}</el-button>
                            <el-button type="primary" @click="aaa">{{col.btnConfirm}}</el-button>
                </el-col>
            </el-row>
            <el-row>
                <!--工厂组件-->
                <list-factorys v-model="formInline.model.CreateFactory" @change="factoryChange"></list-factorys>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{ContractorPersonnelDirectory.ContractorName+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.CBSListId" slot="suffix"
                                           :placeholder="ContractorPersonnelDirectory.ContractorName">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in CBS_Lists" :label="item.contractorName"
                                               :value="item.id"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.PersonnelName"
                                      :placeholder="ContractorPersonnelDirectory.PersonnelName" size="mini">
                                <template slot="prepend">
                                    {{ContractorPersonnelDirectory.PersonnelName+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{ContractorPersonnelDirectory.ConstructionCategory+mark.m}}
                                </template>
                                <el-select @visible-change="visibleChange" v-model="formInline.model.ConstructionCategory" slot="suffix"
                                           :placeholder="ContractorPersonnelDirectory.ConstructionCategory">
                                    <el-option label="请选择" value=""></el-option>
                                    <el-option v-for="item in ConstructionCategory" :label="item.value"
                                               :value="item.key"></el-option>
                                </el-select>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
        </el-form>

        <el-table stripe ref="table" :data="ListItem.tableData"
                  :height="ListItem.tableHeight"
                  border @selection-change="handleSelectionChange" row-style="height:10px"
                  style="width: 100%">
            <el-table-column type="selection" align="center" width="55">
            </el-table-column>
            <el-table-column type="index" :label="ContractorDirectory.SerialNumber"
                             :index="indexMethod" width="50" show-overflow-tooltip="true"></el-table-column>

            <el-table-column prop="personnelName"
                             :label="ContractorPersonnelDirectory.PersonnelName"
                             width="180">
            </el-table-column>
            <el-table-column prop="sexText"
                             :label="ContractorPersonnelDirectory.sex">
            </el-table-column>

            <el-table-column prop="phone"
                             :label="ContractorPersonnelDirectory.phone">
            </el-table-column>
            <el-table-column prop="cbS_List.contractorName"
                             :label="ContractorPersonnelDirectory.ContractorName">
            </el-table-column>
            <el-table-column prop="idNumber"
                             :label="ContractorPersonnelDirectory.IDNumber">
            </el-table-column>
            <el-table-column prop="constructionCategoryName"
                             :label="ContractorPersonnelDirectory.ConstructionCategory">
            </el-table-column>

        </el-table>
        <el-row type="flex" justify="end">
            <el-pagination ref="page" @size-change="handleSizeChange"
                           @current-change="handleCurrentChange"
                           :current-page="ListItem.currentPage"
                           :page-sizes="ListItem.pagesizes"
                           :page-size="ListItem.pagesize"
                           :layout="ListItem.layout"
                           :total="ListItem.total">
            </el-pagination>
        </el-row>
    </div>
    <script type="text/javascript">
        app = new Vue({
            el: '#app',
            data: function () {
                return {
                    CBS_Lists: [],
                    ConstructionCategory: [],
                    ListItem: ListItem,
                    formInline: {
                        model: {
                            CreateFactory: '',
                            personnelName: '',
                            sex: '',
                            phone: '',
                            ContractorName: '',
                            IDNumber: '',
                            ConstructionCategory: '',
                            MainaAchievement: '',
                            CBSListId: ''
                        },
                        offset: 0,
                        limit: 10
                    }
                }
            },created: function () {
                var currApp = this;
                window.onresize = function () {
                    currApp.ListItem.tableHeight = window.innerHeight -
                        currApp.$refs.table.$el.offsetTop - 60;
                    if (currApp.ListItem.tableHeight < 112) {
                        currApp.ListItem.tableHeight = 112;
                    }
                }
            },
            mounted: function () {
                //获取下拉菜单内容
                //this.ConstructionCategory = getDicData('25');
                //获取下拉菜单内容
                this.ConstructionCategory = getDicData('cbssglb');
                //初始化数据
                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                handleNodeClick: function (data) {
                    console.log(data);
                },
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },

                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/CBS_User/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //获取分页数据
                GetPageData: function (currentIndex) { GetPageData(this, currentIndex, '/api/CBS_User/GetList') },
                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },
                //初始化承包商下拉框
                getCBS_List: function () {
                    var mythis = this;
                    myAjax("post", this, '/api/CBS_List/GetList', { model: { status: '', CreateFactory: this.formInline.model.CreateFactory }, offset: 0, limit: 100 }, function (response) {
                        //myAjax("post", this, '/api/CBS_List/GetList/', this.formInline.model.CreateFactory, function (response) {
                        mythis.CBS_Lists = response.data.pageData;
                    }, false);
                },
                factoryChange: function () {
                    this.getCBS_List();
                    this.GetPageData(1);
                },
                aaa: function () {
                    var ap = "答题人:";
                    parent.app.cbS_ExamQuestionsUser = [];
                    if (this.ListItem.tableMultipleSelection.length > 0) {
                        //showMessage(msg.OnlyOne, 'error')
                        //return;
                        for (var i = 0; i < this.ListItem.tableMultipleSelection.length;i++) {
                            if (i == 0) {
                                ap = ap + this.ListItem.tableMultipleSelection[i].personnelName;
                            } else {
                                ap = ap + "," + this.ListItem.tableMultipleSelection[i].personnelName;
                            }
                            parent.app.cbS_ExamQuestionsUser.push({ userId:this.ListItem.tableMultipleSelection[i].id });
                        }
                        parent.app.answerPeople = ap;

                    }
                    //parent.app.answerPeople = "";
                    //parent.app.answerPeople = "答题人:"+this.ListItem.tableMultipleSelection[0].personnelName;
                    parent.app.ListItem.dialogVisible = false;

                }
            }
        });

    </script>
</body>

</html>